using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DealerWorld
{
	public partial class Main : Form
    {
		public static List<RepairOrder> allOrders = new List<RepairOrder>();
		public static List<Customer> allCust = new List<Customer>();
		public static List<Vehicle> allVehicles = new List<Vehicle>();
		
        public Main()
        {
            InitializeComponent();
            button1.Select();

			Vehicle v = new Vehicle(null);
			v.color = "Green";
			v.licensePlate = "5555555";
			v.make = "Pontiac";
			v.mileage = 66000;
			v.model = "Grand Prix GTP";
			v.type = "Passenger Car";
			v.typeId = "L67";
			v.vin = "44444444444444444444";
			v.year = 1998;

			Customer c = new Customer(v);
			c.address = "1200 N. 5610 E.";
			c.birthday = new DateTime(1981, 10, 3);
			c.city = "Orem";
			c.state = "Utah";
			c.contactDay = new DateTime(2007, 11, 10);
			c.contactMethod = "Cell";
			c.country = "USA";
			c.county = "Utah";
			c.employer = "Omniture";
			c.fleetVehicle = false;
			c.gender = "Male";
			c.language = "English";
			c.mainEmail = "email@email.com";
			c.mainPhone = "555-555-5555";
			c.name = "Jeremy Hyde";
			c.taxId = "0";

            v.customer = c;

			RepairOrder ro = new RepairOrder();
			ro.c = c;
			ro.v = v;
			ro.delCode = "10";
			ro.deliveryDate = DateTime.Now;
			ro.engineNo = "L67";
			ro.extWarrantyInfo = "Info";
			ro.fiSalesPerson = "Some Guy";
			ro.inServiceDate = DateTime.Now;
			ro.key = "";
			ro.prodDate = DateTime.Now;
			ro.salesPerson = "Some Other Guy";
			ro.sellingDealer = "Gene Harvey Chevrolet";
			ro.serviceAdvisor = "35";
			ro.specialSchedule = "";
			ro.stickerNo = "";
			ro.unitNo = "";
			ro.warrantyExpDate = DateTime.Now;

			allOrders.Add(ro);
			allCust.Add(c);
            allVehicles.Add(v);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //this open it up as a dialoge window, requiring you to close the window before you can get back to the main form
            new Forms.repair_order(new RepairOrder()).ShowDialog();

            //this opens it as a regular window
            //new Forms.repair_order().Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            new Forms.search_ro().ShowDialog();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            new Forms.search_customer().ShowDialog();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            new Forms.search_vehicle().ShowDialog();
        }

        private void viewToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void Main_KeyUp(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode){
                case Keys.F5:
                    button1_Click(sender, e);
                    break;
                case Keys.F10:
                    button4_Click(sender, e);
                    break;
                case Keys.F9:
                    button2_Click(sender, e);
                    break;
                case Keys.F11:
                    button3_Click(sender, e);
                    break;
                default:
                    //do nothing
                    break;
            }
        }

        private void button1_KeyUp(object sender, KeyEventArgs e)
        {
            Main_KeyUp(sender, e);
        }

        private void button2_KeyUp(object sender, KeyEventArgs e)
        {
            Main_KeyUp(sender, e);
        }

        private void button4_KeyUp(object sender, KeyEventArgs e)
        {
            Main_KeyUp(sender, e);
        }

        private void button3_KeyUp(object sender, KeyEventArgs e)
        {
            Main_KeyUp(sender, e);
        }

        private void menuStrip1_KeyUp(object sender, KeyEventArgs e)
        {
            Main_KeyUp(sender, e);
        }
    }
}